package cn.lavender.web.response.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * <p>
 * 使ApiResponseInterceptor生效
 * </p>
 * @author: zhu.chen
 * @date: 2021/3/29
 * @version: v1.0.0
 */
@Component
public class InterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private ApiResponseInterceptor interceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(interceptor).addPathPatterns("/*");
    }
}
